<template>
	<cl-dialog
		title="同步客服信息"
		width="700px"
		:visible.sync="visible"
		@close="close"
		:props="{
			top: '5vh'
		}"
	>
		<div class="mt-8">
			<cl-filter label="所属企业">
				<cl-select
					v-model="corp_id"
					placeholder="请选择"
					filterable
				>
					<el-option
						v-for="item in corpList"
						:key="item.corpid"
						:label="item.company_name"
						:value="item.corpid"
					/>
				</cl-select>
			</cl-filter>
		</div>
		<template #footer>
			<el-button type="primary" @click="submit">确定</el-button>
			<el-button @click="close">关闭</el-button>
		</template>
	</cl-dialog>
</template>
<script>
export default {
	data() {
		return {
			visible: false,
			corp_id: '',
			corpList: []
		};
	},
	methods: {
		open(type, row) {
			this.visible = true;
			this.getCorpList()
		},
		close() {
			this.visible = false;
		},
		reset() {
			this.saving = false;
		},
		async getCorpList() {
			const biz_id = this.getCurrBiz();
			const data = await this.$service.workwechat.page({biz_id: biz_id})
			this.corpList = data.list
		},
		async submit() {
			await this.$service.config.createServiceList({corpid: this.corp_id})
			this.$emit('confirm')
			this.close()
		}

	}
};
</script>
<style lang="scss" scoped>
::v-deep {
	.el-dialog__body {
		max-height: 70vh;
		overflow: auto;
	}
}
.staff-list {
	display: flex;
	flex-wrap: wrap;
	::v-deep .cl-customer-info {
		width: auto;
		flex-direction: column;
		align-items: center;
		width: 70px;
		.cus-info {
			min-width: auto;
			padding-left: 0;
			margin-top: 10px;
			.cus-name .ellipsis {
				word-break: break-all;
				white-space: pre-wrap;
			}
		}
	}
}
</style>
